package com.qiaofang.applet.service.member.service.mapstruct;

import com.qiaofang.applet.service.member.domain.Employee;
import com.qiaofang.applet.service.member.service.dto.EmployeeDetailDto;
import com.qiaofang.applet.service.member.service.dto.EmployeeListDto;
import com.qiaofang.applet.service.member.service.dto.EmployeeQueryDto;
import com.qiaofang.applet.service.property.service.dto.SalePropertyListDto;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.springframework.data.domain.Page;
import org.springframework.data.repository.support.PageableExecutionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface EmployeeMapper {

    Employee detailDtoToDomain(EmployeeDetailDto employeeDetailDto);

    Employee queryDtoToDomain(EmployeeQueryDto queryDto);

    default EmployeeListDto domainToDto(Employee employee) {
        if (employee == null) {
            return null;
        }

        EmployeeListDto employeeListDto = new EmployeeListDto();

        employeeListDto.setEmployeeUniqueUuid(employee.getEmployeeUniqueUuid());
        employeeListDto.setEmployeeUuid(employee.getEmployeeUuid());
        employeeListDto.setEmployeeName(employee.getEmployeeName());
        employeeListDto.setDeptName(employee.getDeptName());
        employeeListDto.setEmployeePhotoUrl(employee.getPhotoUrl());
        employeeListDto.setPositionName(employee.getPositionName());
        employeeListDto.setMobilePhone(employee.getMobilePhone());
        employeeListDto.setRecommend(employee.getRecommend());
        employeeListDto.setRecommendDescribe(employee.getRecommendDescribe());

        return employeeListDto;
    }

}
